/*********************************************************************NVMH3****
/ fragment shader for blending the alpha channel
******************************************************************************/
// get the two lightmaps and blend them together

uniform sampler2D Original;
uniform sampler2D LightMap;

uniform vec4 blendAmount;
varying float diffuse;
varying vec4  texcoord[2];

void main(void)
{
    // sample color from a texture
    vec4 base_color  = texture2D(Original,  vec2(texcoord[0]));
    vec4 speed       = texture2D(LightMap,  vec2(texcoord[1]));

    base_color = base_color * diffuse ;
    
    // add alpha channel
    
    base_color.a = speed.r + blendAmount.a;
    float blendperc =  (blendAmount.a  - 0.5) * 2.0 ;

    base_color.a = speed.r + blendperc;
    
    gl_FragColor = base_color;

}
